﻿using DG.Tweening;
using UnityEngine;

namespace HKTools
{
    public class HK_OptionPanelCtrl : HK_SimpleDialogController
    {
        CanvasGroup optionPanel_CG;

        void Awake()
        {
            optionPanel_CG = GetComponent<CanvasGroup>();
            optionPanel_CG.alpha = 0;
            optionPanel_CG.interactable = false;
        }

        public void ShowAnim(bool isImmediately = false)
        {
            if (isImmediately)
            {
                DOTween.Complete(gameObject);
                //transform.localScale = Vector3.one;
                optionPanel_CG.alpha = 1;
                optionPanel_CG.interactable = true;
            }
            else
            {
                DOTween.Complete(gameObject);
                //transform.localScale = new Vector3(1, 0, 1);
                //transform.DOScaleY(1, 0.6f);
                optionPanel_CG.alpha = 0;
                optionPanel_CG.DOFade(1, 0.6f);
                optionPanel_CG.interactable = true;
            }
        }

        public void HideAnim(bool isImmediately = false)
        {
            if (isImmediately)
            {
                DOTween.Complete(gameObject);
                //transform.localScale = new Vector3(1, 0, 1);
                optionPanel_CG.alpha = 0;
                optionPanel_CG.interactable = false;
            }
            else
            {
                DOTween.Complete(gameObject);
                //transform.localScale = new Vector3(1, 1, 1);
                //transform.DOScaleY(0, 0.6f);
                optionPanel_CG.alpha = 1;
                optionPanel_CG.DOFade(0, 0.6f);
                optionPanel_CG.interactable = false;
            }
        }
    }
}